/*
 *      net-sim - link
 *
 * 		Links.java
 *
 *      Copyright 23/12/2008 nicolas
 *
 *      This program is free software; you can redistribute it and/or modify
 *      it under the terms of the GNU General Public License as published by
 *      the Free Software Foundation; either version 3 of the License, or
 *      (at your option) any later version.
 *
 *      This program is distributed in the hope that it will be useful,
 *      but WITHOUT ANY WARRANTY; without even the implied warranty of
 *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *      GNU General Public License for more details.
 *
 *      You should have received a copy of the GNU General Public License
 *      along with this program; if not, write to the Free Software
 *      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 *      MA 02110-1301, USA.
 */
package link;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

import exceptions.NodeException;

// TODO: Auto-generated Javadoc
/**
 * The Class Links.
 */
public class Links {

  /** The Links. */
  public Map<String, Link> Links = null;  // Tabla con los links

  /**
   * Instantiates a new links.
   */
  public Links(){
    Links=new HashMap<String, Link>();
  }

  /**
   * Agrega un Link a la lista. Se deberia chequear validez
   *
   * @param name the name
   * @param laddr the laddr
   * @param lport the lport
   * @param raddr the raddr
   * @param rport the rport
   *
   * @return the link
   *
   * @throws NodeException the node exception
   */
  public Link addLink(String name, String laddr, String lport, String raddr, String rport)
      throws NodeException  {
    Link ln = new Link(laddr, lport, raddr, rport);
    Links.put(name, ln);
    return ln;
  }


  /* (non-Javadoc)
   * @see java.lang.Object#toString()
   */
  public String toString() {
    Set<String> keySet = Links.keySet();
    for (String elementKey : keySet) {
      Link i = Links.get(elementKey);
      System.out.println("Link: "+ i.toString());
    }
    return "eee";
  }

}



